import { type usertype } from './user';
import AsyncStorage from '@react-native-async-storage/async-storage';

const storeSet = async (key:string,value:any) => {
  let response = '';
  value = JSON.stringify(value);
  try {
    response = await AsyncStorage.setItem(key,value)
  }catch(error){
    console.log('storeSet is error', error);
  }
}

const storeGet = async (key:string) => {
  let response;
  try{
    response = await AsyncStorage.getItem(key);
    if(response==null){
      console.log('stroeGet is null:',response);
    }
  }catch(error){
    console.log('stroeGet is error:', error);
  }
  return JSON.parse(response);
}


export { storeGet, storeSet};